package com.hyf.test;

import com.hyf.bean.User;
import com.mchange.v2.c3p0.ComboPooledDataSource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringRunner;

import java.sql.Connection;
import java.sql.SQLException;

@RunWith(SpringRunner.class)
@ContextConfiguration("classpath:spring.xml")
public class Springtest {
    @Autowired
    User u1;
    @Autowired
    ComboPooledDataSource c3p0;
    @Test
    public void u1()
    {
        System.out.println(u1);
    }
    @Test
    public void c3p0()throws SQLException {
        Connection connection = c3p0.getConnection();
        System.out.println(connection);
    }
}
